Conditions | 3 |
Total Lines | 30 |
Code Lines | 27 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | /* eslint-disable promise/prefer-await-to-callbacks */ |
||
5 | |||
6 | export async function run(): Promise<void> { |
||
7 | // Create the mocha test |
||
8 | const mocha = new Mocha({ |
||
9 | ui : 'tdd', |
||
10 | color : true |
||
11 | }); |
||
12 | |||
13 | const testsRoot = path.resolve(__dirname, '..'); |
||
14 | |||
15 | const files = await glob('**/**.test.js', { cwd: testsRoot }); |
||
16 | |||
17 | console.log('files:', files); |
||
18 | |||
19 | return new Promise((c, e) => { |
||
20 | // Add files to the test suite |
||
21 | files.forEach(f => mocha.addFile(path.resolve(testsRoot, f))); |
||
22 | |||
23 | try { |
||
24 | // Run the mocha test |
||
25 | mocha.run(failures => { |
||
26 | if (failures > 0) { |
||
27 | e(new Error(`${failures} tests failed.`)); |
||
28 | } else { |
||
29 | c(); |
||
30 | } |
||
31 | }); |
||
32 | } catch (error) { |
||
33 | console.error(error); |
||
34 | e(error); |
||
35 | } |
||
38 |